#[doc = "Register `LSADC_CTRL2` reader"]
pub struct R(crate::R<LSADC_CTRL2_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<LSADC_CTRL2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<LSADC_CTRL2_SPEC>> for R {
    fn from(reader: crate::R<LSADC_CTRL2_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `LSADC_CTRL2` writer"]
pub struct W(crate::W<LSADC_CTRL2_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<LSADC_CTRL2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<LSADC_CTRL2_SPEC>> for W {
    fn from(writer: crate::W<LSADC_CTRL2_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Threshold interrupt mask.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXIM_A {
    #[doc = "0: Masked."]
    MASKED = 0,
    #[doc = "1: Unmasked."]
    UNMASKED = 1,
}
impl From<RXIM_A> for bool {
    #[inline(always)]
    fn from(variant: RXIM_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `rxim` reader - Threshold interrupt mask."]
pub struct RXIM_R(crate::FieldReader<bool, RXIM_A>);
impl RXIM_R {
    pub(crate) fn new(bits: bool) -> Self {
        RXIM_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RXIM_A {
        match self.bits {
            false => RXIM_A::MASKED,
            true => RXIM_A::UNMASKED,
        }
    }
    #[doc = "Checks if the value of the field is `MASKED`"]
    #[inline(always)]
    pub fn is_masked(&self) -> bool {
        **self == RXIM_A::MASKED
    }
    #[doc = "Checks if the value of the field is `UNMASKED`"]
    #[inline(always)]
    pub fn is_unmasked(&self) -> bool {
        **self == RXIM_A::UNMASKED
    }
}
impl core::ops::Deref for RXIM_R {
    type Target = crate::FieldReader<bool, RXIM_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rxim` writer - Threshold interrupt mask."]
pub struct RXIM_W<'a> {
    w: &'a mut W,
}
impl<'a> RXIM_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RXIM_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "Masked."]
    #[inline(always)]
    pub fn masked(self) -> &'a mut W {
        self.variant(RXIM_A::MASKED)
    }
    #[doc = "Unmasked."]
    #[inline(always)]
    pub fn unmasked(self) -> &'a mut W {
        self.variant(RXIM_A::UNMASKED)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
        self.w
    }
}
#[doc = "FIFO overflow interrupt mask.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RORIM_A {
    #[doc = "0: Masked."]
    MASKED = 0,
    #[doc = "1: Unmasked."]
    UNMASKED = 1,
}
impl From<RORIM_A> for bool {
    #[inline(always)]
    fn from(variant: RORIM_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `rorim` reader - FIFO overflow interrupt mask."]
pub struct RORIM_R(crate::FieldReader<bool, RORIM_A>);
impl RORIM_R {
    pub(crate) fn new(bits: bool) -> Self {
        RORIM_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RORIM_A {
        match self.bits {
            false => RORIM_A::MASKED,
            true => RORIM_A::UNMASKED,
        }
    }
    #[doc = "Checks if the value of the field is `MASKED`"]
    #[inline(always)]
    pub fn is_masked(&self) -> bool {
        **self == RORIM_A::MASKED
    }
    #[doc = "Checks if the value of the field is `UNMASKED`"]
    #[inline(always)]
    pub fn is_unmasked(&self) -> bool {
        **self == RORIM_A::UNMASKED
    }
}
impl core::ops::Deref for RORIM_R {
    type Target = crate::FieldReader<bool, RORIM_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rorim` writer - FIFO overflow interrupt mask."]
pub struct RORIM_W<'a> {
    w: &'a mut W,
}
impl<'a> RORIM_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RORIM_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "Masked."]
    #[inline(always)]
    pub fn masked(self) -> &'a mut W {
        self.variant(RORIM_A::MASKED)
    }
    #[doc = "Unmasked."]
    #[inline(always)]
    pub fn unmasked(self) -> &'a mut W {
        self.variant(RORIM_A::UNMASKED)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
        self.w
    }
}
impl R {
    #[doc = "Bit 1 - Threshold interrupt mask."]
    #[inline(always)]
    pub fn rxim(&self) -> RXIM_R {
        RXIM_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 0 - FIFO overflow interrupt mask."]
    #[inline(always)]
    pub fn rorim(&self) -> RORIM_R {
        RORIM_R::new((self.bits & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 1 - Threshold interrupt mask."]
    #[inline(always)]
    pub fn rxim(&mut self) -> RXIM_W {
        RXIM_W { w: self }
    }
    #[doc = "Bit 0 - FIFO overflow interrupt mask."]
    #[inline(always)]
    pub fn rorim(&mut self) -> RORIM_W {
        RORIM_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "LSADC_CTRL2 is the ADC interrupt control register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lsadc_ctrl2](index.html) module"]
pub struct LSADC_CTRL2_SPEC;
impl crate::RegisterSpec for LSADC_CTRL2_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [lsadc_ctrl2::R](R) reader structure"]
impl crate::Readable for LSADC_CTRL2_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [lsadc_ctrl2::W](W) writer structure"]
impl crate::Writable for LSADC_CTRL2_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets LSADC_CTRL2 to value 0"]
impl crate::Resettable for LSADC_CTRL2_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
